Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unset fields in probes set by container-overrides #1169

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

amisevsk
Copy link
Collaborator

What does this PR do?

Updates how probes (readiness, liveness, startup) are handled when defined in container-overrides. Since fields for success/failure threshold, period, and timeout are defaulted by the cluster, we have to make sure they're either set to user-provided values or the defaults to avoid repeatedly reconciling the deployment yaml

What issues does this PR fix or reference?

Closes #1093

Is it tested? How?

To test, you can use the workspace

kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: test-dw
spec:
  started: true
  template:
    attributes:
      controller.devfile.io/storage-type: ephemeral
    components:
      - name: terminal
        container:
          image: quay.io/wto/web-terminal-tooling:next
          memoryLimit: 512Mi
          mountSources: true
          command:
           - "tail"
           - "-f"
           - "/dev/null"
        attributes:
          container-overrides:
            readinessProbe:
              exec:
                command: ["echo", "hello"]
            livenessProbe:
              exec:
                command: ["echo", "hello"]
            startupProbe:
              exec:
                command: ["echo", "hello"]

This workspace should start normally with defaulted fields for the probes.

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

When a container defines readiness/liveness/startup probes, fields for
success/failure threshold, period, and timeout are set automatically by
the cluster if they are unset, and this change is stored in the pod spec
on-cluster.

To avoid entering a reconcile loop where we unset these fields -> the
cluster defaults them, we have to make sure to use the default values in
our internal spec.

Signed-off-by: Angel Misevski <[email protected]>
@amisevsk amisevsk modified the milestone: v0.23.x Aug 24, 2023
@amisevsk amisevsk changed the title Probes handling Handle unset fields in probes set by container-overrides Aug 24, 2023
Copy link
Collaborator

@AObuchow AObuchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM & works as expected 👍

@openshift-ci
Copy link

openshift-ci bot commented Aug 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, AObuchow

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@amisevsk amisevsk merged commit 3889f6b into devfile:main Aug 24, 2023
4 checks passed
@amisevsk amisevsk deleted the probes-handling branch August 24, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Operator does not handle defaulted fields in readiness/liveness probes if unset
2 participants